home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11857 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  68 lines

  1. Path: news.uh.edu!usenet
  2. From: Sensarn <txs53132@bayou.uh.edu>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Why won't this work?
  5. Date: 16 Mar 1996 18:20:18 GMT
  6. Organization: AEtna Insurance Agency
  7. Message-ID: <4if0p2$ps6@masala.cc.uh.edu>
  8. References: <4icjqa$km4@masala.cc.uh.edu> <314AEA07.B60@airmail.net>
  9. NNTP-Posting-Host: sip-14256.public-dialups.uh.edu
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1 (Windows; U; 16bit)
  14.  
  15. Mark Nelson <markn@airmail.net> wrote:
  16. >Sensarn wrote:
  17. >> 
  18. >> struct human {
  19. >>     int age;
  20. >> };
  21. >> 
  22. >> void main(void) {
  23. >>     human bob;
  24. >>     asm mov ax,bob.age; /* Expression Syntax error here */
  25. >> }
  26. >> 
  27. >> Please help
  28. >> 
  29. >
  30. >While most MS-DOS/Windows compilers support some sort of in-line assembly, 
  31. >their capabilities differe greatly.  You need to specify which compiler
  32. >you are using in order to determine what it can and cannot do.  For example,
  33. >if you are using Watcom, the code shown above will never work, because
  34. >you have to put your asm code in a function definition via pragma.
  35. >
  36. >I use inline assembly in one place in Greenleaf ArchiveLib, and it
  37. >is a horrible looking mess of #ifdefs and hacks, since I'm supporting 
  38. >a whole bunch of different compilers.  Ugh.
  39.  
  40. I can use the inline assembler with ANY variable (almost) except class 
  41. members.  Should I just use another variable as a representation:
  42.  
  43. struct human {
  44.     int age;
  45. };
  46.  
  47. void main(void) {
  48.     human bob;
  49.     int bobsage=bob.age;
  50.     asm mov ax,bobsage; /* Works now? */
  51. }
  52.  
  53. That works...
  54.  
  55. >
  56. >Mark Nelson
  57. >http://web2.airmail.net/markn
  58.  
  59.  
  60. -- 
  61. ______________________________
  62.  
  63. Steven Sensarn
  64. E-Mail - txs53132@bayou.uh.edu
  65. ______________________________
  66.  
  67.  
  68.